# Server Specific Configurations
server = {
    'port': '443',
    'host': '0.0.0.0'
}

# Pecan Application Configurations
app = {
    'root': 'api.root.RootController',
    'modules': ['cloud_pecan'],
    'debug': True,
}

DEBUG = True
if DEBUG:
    LOG_HANDLES = ['file_handler', 'console_handler']
else:
    LOG_HANDLES = ['console_handler']

logging = {
    'version': 1,
    'disable_exsisting_logging': True,
    # 'root': {'level': 'INFO', 'handlers': ['console']},
    'loggers': {
        # 'pecan': {'level': 'DEBUG', 'handlers': ['console'], 'propagate': False},
        # 'py.warnings': {'handlers': ['console']},
        '': {'level': 'INFO', 'handlers': LOG_HANDLES},
    },
    'handlers': {
        'file_handler': {
            'level': 'INFO',
            'class': 'logging.handlers.RotatingFileHandler',
            'backupCount': 30,
            'filename': 'cloud_pecan.log',
            'formatter': 'basic',
            'mode': 'a+',
            'maxBytes': 5 * 1024 * 1024,
            'encoding': 'utf8'
        },
        'console_handler': {
            'class': 'logging.StreamHandler',
            'level': 'DEBUG',
            'formatter': 'basic',
            'stream': 'ext://sys.stdout'
        }
    },
    'formatters': {
        'basic': {
            'format': '[%(asctime)s] %(module)s:(lineno)d'
                      ' [%(levelname)s] %(message)s'
        },
        'simple': {
            'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]'
                       '[%(threadName)s] %(message)s')
        },
    }
}
